package com.heima.user.controller.v1;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.apis.user.ApFollowControllerApi;
import com.heima.model.user.pojos.ApUserFollow;
import com.heima.user.service.ApUserFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/apFollow")
public class ApFollowController implements ApFollowControllerApi {

    @Autowired
    ApUserFollowService apUserFollowService;


    @GetMapping("/follow/{authorUserId}/{userId}")
    @Override
    public ApUserFollow getFollow(@PathVariable("authorUserId") Integer authorUserId,@PathVariable("articleId") Long userId) {

        return apUserFollowService.getOne(Wrappers.<ApUserFollow>lambdaQuery().eq(ApUserFollow::getFollowId,authorUserId).eq(ApUserFollow::getUserId,userId));
    }
}
